// 统一样式混合器 - 透明玻璃主题
// 导入变量
@use './variables.scss' as *;

// ==================== 基础混合器 ====================
// 透明玻璃效果基础样式
@mixin glass-base {
  background: $bg-primary;
  border: 1px solid $border-primary;
  backdrop-filter: $blur-light;
  -webkit-backdrop-filter: $blur-light;
  border-radius: $radius-medium;
  transition: $transition-normal;
}

// 透明玻璃悬停效果
@mixin glass-hover {
  background: $bg-hover;
  border-color: $border-hover;
}

// 透明玻璃聚焦效果
@mixin glass-focus {
  background: $bg-focus;
  border-color: $border-focus;
  box-shadow: $shadow-glow;
}

// ==================== 组件混合器 ====================
// 输入框样式
@mixin input-glass {
  @include glass-base;
  color: $text-primary;
  box-shadow: $shadow-inset;

  &::placeholder {
    color: $text-placeholder;
  }

  &:hover {
    @include glass-hover;
  }

  &:focus,
  &.is-focus {
    @include glass-focus;
  }
}

// 选择框样式
@mixin select-glass {
  width: 100%;

  .el-input__wrapper {
    @include input-glass;

    .el-input__inner {
      color: $text-primary;
      background: transparent;
      font-size: $font-size-base;
      font-weight: 500;

      &::placeholder {
        color: $text-placeholder;
      }
    }

    .el-input__suffix {
      .el-input__suffix-inner {

        .el-select__caret,
        .el-icon {
          color: $text-placeholder;

          &:hover {
            color: $primary-color;
          }
        }
      }
    }
  }

  .el-select__placeholder {
    color: $text-placeholder;
  }

  .el-select__selected-item {
    color: $text-primary;
  }

  .el-select__tags {
    .el-tag {
      background: $bg-selected;
      border-color: $primary-color-light;
      color: $text-primary;

      .el-tag__close {
        color: $text-secondary;

        &:hover {
          color: $text-primary;
          background: $bg-hover;
        }
      }
    }
  }
}

// 下拉菜单样式
@mixin dropdown-glass {
  background: $bg-secondary;
  border: 1px solid $border-primary;
  backdrop-filter: $blur-heavy saturate(150%);
  -webkit-backdrop-filter: $blur-heavy saturate(150%);
  box-shadow: $shadow-heavy, inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-radius: $radius-large;
  z-index: 9999;

  .el-select-dropdown__item,
  .el-dropdown-item,
  .el-dropdown-menu__item {
    color: $text-secondary;
    background: transparent;
    border-radius: $radius-medium;
    margin: 2px 6px;
    padding: 8px 12px;
    transition: $transition-normal;
    font-size: $font-size-base;
    font-weight: 500;
    line-height: 20px;
    height: auto;
    min-height: auto;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: visible;
    text-overflow: ellipsis;

    &:hover {
      background: rgba(0, 234, 255, 0.15);
      color: $text-primary;
      transform: translateX(2px);
      box-shadow: $shadow-light;
    }

    &.selected,
    &.is-selected {
      background: rgba(0, 234, 255, 0.25);
      color: $text-primary;
      font-weight: 600;
      box-shadow: $shadow-medium;
    }

    &.is-disabled {
      color: $text-disabled;
      background: transparent;
      cursor: not-allowed;

      &:hover {
        background: transparent;
        transform: none;
        box-shadow: none;
      }
    }

    i {
      margin-right: 6px;
      color: rgba(0, 234, 255, 0.8);
    }
  }

  .el-dropdown-menu__item--divided {
    border-top: 1px solid $border-primary;
    margin-top: 6px;
    padding-top: 12px;
  }
}

// 按钮样式
@mixin button-glass {
  @include glass-base;
  color: $text-primary;
  font-weight: 500;
  padding: 8px 16px;

  &:hover {
    @include glass-hover;
  }

  &:focus {
    @include glass-focus;
  }

  &.el-button--primary {
    background: linear-gradient(135deg, rgba(60, 140, 231, 0.8), rgba(0, 234, 255, 0.8));
    border-color: $primary-color;

    &:hover {
      background: linear-gradient(135deg, rgba(60, 140, 231, 0.9), rgba(0, 234, 255, 0.9));
    }
  }
}

// 弹窗样式
@mixin dialog-glass {
  background: $bg-primary;
  border: 1px solid $border-primary;
  backdrop-filter: $blur-heavy;
  -webkit-backdrop-filter: $blur-heavy;
  box-shadow: $shadow-heavy, inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-radius: $radius-large;

  .el-dialog__header {
    background: transparent;
    border-bottom: 1px solid $border-primary;

    .el-dialog__title {
      color: $text-primary;
      font-weight: 600;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    .el-dialog__headerbtn .el-dialog__close {
      color: $text-secondary;

      &:hover {
        color: $primary-color;
      }
    }
  }

  .el-dialog__body {
    background: transparent;
    color: $text-primary;
  }

  .el-dialog__footer {
    background: transparent;
    border-top: 1px solid $border-primary;
  }
}

// 表格样式
@mixin table-glass {
  background: $bg-secondary;
  backdrop-filter: $blur-medium;
  -webkit-backdrop-filter: $blur-medium;
  border: 1px solid $border-primary;
  border-radius: $radius-large;
  box-shadow: $shadow-medium;
}

// ==================== 工具混合器 ====================
// 清除默认样式
@mixin reset-element-plus {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

// 应用选择框样式到指定选择器
@mixin apply-select-glass($selector: '.el-select') {
  #{$selector} {
    @include select-glass;
  }
}

// 应用下拉菜单样式到指定选择器
@mixin apply-dropdown-glass($selector: '.el-select-dropdown') {
  :deep(#{$selector}) {
    @include dropdown-glass;
  }
}